package org.gitman.filmBase.model;

import java.util.Collection;
import java.util.Date;
import java.util.LinkedList;

public class Film {
	
	private Integer idFilm;
	private String title;
	private String orginalTitle;
	private String description;
	private Integer yearOfProduction;
	private Double filmwebRank;
	private Date duration;
	private Date addedToSystem;
	private Boolean seen;
	private String url;
	private String location;
	
	private Collection<Genre> genres;
	private Collection<Country> countriesOfProduction;
	private Collection<Person> directors;
	private Collection<Person> actors;
	private Collection<Person> screenWriters;
	
	public Film(){
		genres = new LinkedList<Genre>();
		countriesOfProduction = new LinkedList<Country>();
		directors = new LinkedList<Person>();
		actors = new LinkedList<Person>();
		screenWriters = new LinkedList<Person>();
	}
	public Film(
			String title,
			String orginalTitle,
			String description,
			Integer yearOfProduction,
			Double filmwebRank,
			Integer hrs,
			Integer min,
			Date addedToSystem,
			Boolean seen,
			String url,
			String location,
			Genre [] genres,
			Country [] countriesOfProduction,
			Person [] directors,
			Person [] actors,
			Person [] screenWriters
			){
		this.genres = new LinkedList<Genre>();
		this.countriesOfProduction = new LinkedList<Country>();
		this.directors = new LinkedList<Person>();
		this.actors = new LinkedList<Person>();
		this.screenWriters = new LinkedList<Person>();
		this.title = title;
		this.orginalTitle = orginalTitle;
		this.description = description;
		this.yearOfProduction = yearOfProduction;
		this.filmwebRank = filmwebRank;
		this.duration = new Date(0, 0, 0, hrs, min);
		this.addedToSystem = addedToSystem;
		this.seen = seen;
		this.url = url;
		this.location = location;
		for(Genre g : genres){
			addGenere(g);
		}
		for(Country c : countriesOfProduction){
			addCountriesOfProduction(c);
		}
		for(Person p : directors){
			addDirector(p);
		}
		for(Person p : actors){
			addActor(p);
		}
		for(Person p : screenWriters){
			addScreenWriter(p);
		}
	}
	
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public Integer getYearOfProduction() {
		return yearOfProduction;
	}
	public void setYearOfProduction(Integer yearOfProduction) {
		this.yearOfProduction = yearOfProduction;
	}
	public Double getFilmwebRank() {
		return filmwebRank;
	}
	public void setFilmwebRank(Double filmwebRank) {
		this.filmwebRank = filmwebRank;
	}
	public Date getDuration() {
		return duration;
	}
	public void setDuration(Date duration) {
		this.duration = duration;
	}
	public void setDuration(int hrs, int min){
		this.duration = new Date(0, 0, 0, hrs, min);
	}
	public Boolean getSeen() {
		return seen;
	}
	public void setSeen(Boolean seen) {
		this.seen = seen;
	}
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public String getLocation() {
		return location;
	}
	public void setLocation(String location) {
		this.location = location;
	}
	public Collection<Genre> getGenres() {
		return genres;
	}
	public void setGenres(Collection<Genre> genres) {
		this.genres = genres;
	}
	public Collection<Country> getCountriesOfProduction() {
		return countriesOfProduction;
	}
	public void setCountriesOfProduction(Collection<Country> countriesOfProduction) {
		this.countriesOfProduction = countriesOfProduction;
	}
	public Collection<Person> getDirectors() {
		return directors;
	}
	public void setDirectors(Collection<Person> directors) {
		this.directors = directors;
	}
	public Collection<Person> getActors() {
		return actors;
	}
	public void setActors(Collection<Person> actors) {
		this.actors = actors;
	}
	public Collection<Person> getScreenWriters() {
		return screenWriters;
	}
	public void setScreenWriters(Collection<Person> screenWriters) {
		this.screenWriters = screenWriters;
	}
	public String getOrginalTitle() {
		return orginalTitle;
	}
	public void setOrginalTitle(String orginalTitle) {
		this.orginalTitle = orginalTitle;
	}
	public Date getAddedToSystem() {
		return addedToSystem;
	}
	public void setAddedToSystem(Date addedToSystem) {
		this.addedToSystem = addedToSystem;
	}
	public void addActor(Person actor){
		actor.addActorRole(this);
		actors.add(actor);
	}
	public void addDirector(Person director){
		director.addDdirectorRole(this);
		directors.add(director);
	}
	public void addScreenWriter(Person screenWriter){
		screenWriter.addScreenWriterRole(this);
		screenWriters.add(screenWriter);
	}
	public void addCountriesOfProduction(Country country){
		countriesOfProduction.add(country);
	}
	public void addGenere(Genre genre){
		genres.add(genre);
	}
		
}
